Vue.component('zh-nav', {
    template: `<nav class="home-nav">
                    <ul class="home-ul clearfix">
                        <li class="nav-li" v-for="(item,index) in nav" @click="navItem(item.text)">
                            <img class="nav-img" :src="item.img" :alt="item.text">
                            <span class="nav-text">{{item.text}}</span>
                        </li>
                    </ul>
                </nav>`,
    data: function () {
        return {}
    },
    props: {
        'nav': {
            type: Array,
        }
    },
    methods: {
        navItem: function (data) {
            console.log(data)
            switch (data) {
                case "美食":
                    window.location.href = 'home_food.html';
                    console.log("美食")
                    break;
                case '超市':
                    window.location.href = 'home_food.html';
                    console.log('超市')
                    break;
                case '休闲娱乐':
                    window.location.href = 'home_food.html';
                    console.log('休闲娱乐')
                    break;
                case '运动健身':
                    window.location.href = 'home_food.html';
                    console.log('运动健身')
                    break;
                case '丽人':
                    window.location.href = 'home_food.html';
                    console.log('丽人')
                    break;
                case 'KTV':
                    window.location.href = 'home_food.html';
                    console.log('KTV')
                    break;
                case '摄影':
                    window.location.href = 'home_food.html';
                    console.log('摄影')
                    break;
                case '全部':
                    window.location.href = 'home_all.html';
                    console.log('全部')
                    break;
                case '食品特产':
                    window.location.href = 'home_food.html';
                    console.log('食品特产')
                    break;
                case '服装鞋帽':
                    window.location.href = 'home_food.html';
                    console.log('服装鞋帽')
                    break;
                case '美妆个护':
                    window.location.href = 'home_food.html';
                    console.log('美妆个护')
                    break;
                case '家居生活':
                    window.location.href = 'home_food.html';
                    console.log('家居生活')
                    break;
                case '健康养生':
                    window.location.href = 'home_food.html';
                    console.log('健康养生')
                    break;
                case '数码电器':
                    window.location.href = 'home_food.html';
                    console.log('数码电器')
                    break;
                case '母婴玩具':
                    window.location.href = 'home_food.html';
                    console.log('母婴玩具')
                    break;
                case '箱包皮具':
                    window.location.href = 'home_food.html';
                    console.log('箱包皮具')
                    break;
            }
        },
    }
})